<!DOCTYPE html>
<html>
	<head>
		<script src="../JQuery/jquery-3.6.0.min.js"></script>
		<meta charset="utf-8">
		<title>17ReTestMybatis</title>

		<script>
			// function th_fn_1(){
			// 	$.ajax({
			// 		url:"http://localhost:8080/dept/getAll",
			// 		data:$("#13_form_1").serialize(),
			// 		success :function(data){
			// 			$("#13_h5_1").text(JSON.stringify(data));
			// 			console.log("success!!!");
			// 		},
			// 		error:function(data){
			// 			$("#13_h5_1").text(JSON.stringify(data));
			// 			console.log("error!!!");
			// 		}
					
			// 	})
			// }
			function th_fn_2(){
				$.ajax({
					url:"http://localhost:8080/dept/getBy",
					data:$("#13_form_2").serialize(),
					success :function(data){
						$("#13_h5_2").text(JSON.stringify(data));
						console.log("success!!!");
					},
					error:function(data){
						$("#13_h5_2").text(JSON.stringify(data));
						console.log("error!!!");
					}
					
				})
			}
			
			function th_fn_3(){
				$.ajax({
					url:"http://localhost:8080/emp/getAll",
					data:$("#13_form_3").serialize(),
					success :function(data){
						for(var i =0;i<data.length;i++){
						$("#13_h5_"+(i+3)).text(JSON.stringify(data[i]));
						}
						console.log("success!!!");
					},
					error:function(data){
						$("#13_h5_3").text(JSON.stringify(data));
						console.log("error!!!");
					}
					
				})
			}
		</script>


	</head>
	<body>
		<!-- <h5 id="13_h5_1">13_h5_1</h5> -->
		<h5 id="13_h5_2">13_h5_2</h5>
		<h5 id="13_h5_3">13_h5_3</h5>
		<h5 id="13_h5_4">13_h5_4</h5>
		<h5 id="13_h5_5">13_h5_5</h5>
		<h5 id="13_h5_6">13_h5_6</h5>
		<h5 id="13_h5_7">13_h5_7</h5>
		<h5 id="13_h5_8">13_h5_8</h5>
		<h5 id="13_h5_9">13_h5_9</h5>
		<h5 id="13_h5_10">13_h5_10</h5>
		<!-- <form action="#" method="post" id="13_form_1">

			<input type="button" onclick="th_fn_1();" value="点击显示" />
		</form> -->

		<form action="#" method="post" id="13_form_2">
			<table>
				<tr>
					<td>
						id:<input type="text" name="id" />
					</td>
				</tr>
				<tr>
					<td>

						dname:<input type="text" name="dname" />
					</td>
				</tr>
				<tr>
					<td>
						loc:<input type="text" name="loc" />
					</td>
				</tr>

			</table>
			<input type="button" onclick="th_fn_2();" value="点击显示" />
		</form>

		<form action="#" method="post" id="13_form_3">
			<table>
				<tr>
					<td>点击显示emp表数据</td>
				</tr>

			</table>
			<input type="button" onclick="th_fn_3();" value="点击显示" />
		</form>


	</body>
</html>
